package cn.fyl.Lx;

import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class XhrProducer {

    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("group_name");

        producer.setNamesrvAddr("localhost:9876");

        producer.start();

        Message msg = new Message("topic", "简直太热了".getBytes(StandardCharsets.UTF_8));

        producer.send(msg, new SendCallback() {
            @Override
            public void onSuccess(SendResult sendResult) {
                System.out.println("消费成功");
            }

            @Override
            public void onException(Throwable throwable) {
                System.out.println("消费失败");
            }
        });
        System.out.println("sb");




    }
}
